The REPEAT Statement
The REPEAT statement, like the WHILE statement, executes the same script section repeatedly until its control expression evaluates to FALSE. Unlike the WHILE statement, however, the REPEAT statement evaluates the control expression after executing its controlled statement. This means that the controlled statement will always execute at least once.
The general syntax for the REPEAT statement is:
REPEAT <statement> UNTIL <control expression>;
The example from the WHILE statement section could easily be rewritten using a REPEAT statement:
 
 SetSelect(h);
UNTIL (h = NIL);
In this format, the statements within the REPEAT-UNTIL structure would be executed at least once, whether or not h was initially NIL, which could cause detrimental effects or errors. Generally speaking, REPEAT statements should be used in conditions where executing the controlled statement will not have a negative impact. WHILE statements are most useful when the condition controlling their execution may have already been satisfied; REPEAT statements, on the other hand, are most useful when the condition can be satisfied only by executing the statement.
Also note that REPEAT statements do not require the use of BEGIN or END, as the REPEAT and UNTIL keywords create their own compound statement out of the statements between them.

Statements : Repetition Statements : The REPEAT Statement

Nemetschek NA
Phone: 410.290.5114
Fax: 410.290.8050